{
 "nbformat": 4,
 "nbformat_minor": 2,
 "metadata": {
  "language_info": {
   "name": "python",
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "version": "3.7.6-final"
  },
  "orig_nbformat": 2,
  "file_extension": ".py",
  "mimetype": "text/x-python",
  "name": "python",
  "npconvert_exporter": "python",
  "pygments_lexer": "ipython3",
  "version": 3,
  "kernelspec": {
   "name": "python37664bitwuhan2019ncovpipenv5f20d42ee8464e6b95cd78c3cee9d475",
   "display_name": "Python 3.7.6 64-bit ('Wuhan-2019-nCoV': pipenv)"
  }
 },
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": "– 伊博语\" lang=\"ig\" hreflang=\"ig\" class=\"interlanguage-link-target\">Igbo</a></li><li class=\"interlanguage-link interwiki-ilo\"><a href=\"https://ilo.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 伊洛卡诺语\" lang=\"ilo\" hreflang=\"ilo\" class=\"interlanguage-link-target\">Ilokano</a></li><li class=\"interlanguage-link interwiki-is\"><a href=\"https://is.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 冰岛语\" lang=\"is\" hreflang=\"is\" class=\"interlanguage-link-target\">Íslenska</a></li><li class=\"interlanguage-link interwiki-it\"><a href=\"https://it.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 意大利语\" lang=\"it\" hreflang=\"it\" class=\"interlanguage-link-target\">Italiano</a></li><li class=\"interlanguage-link interwiki-ja\"><a href=\"https://ja.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 日语\" lang=\"ja\" hreflang=\"ja\" class=\"interlanguage-link-target\">日本語</a></li><li class=\"interlanguage-link interwiki-jv\"><a href=\"https://jv.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 爪哇语\" lang=\"jv\" hreflang=\"jv\" class=\"interlanguage-link-target\">Jawa</a></li><li class=\"interlanguage-link interwiki-ka\"><a href=\"https://ka.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 格鲁吉亚语\" lang=\"ka\" hreflang=\"ka\" class=\"interlanguage-link-target\">ქართული</a></li><li class=\"interlanguage-link interwiki-kaa\"><a href=\"https://kaa.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 卡拉卡尔帕克语\" lang=\"kaa\" hreflang=\"kaa\" class=\"interlanguage-link-target\">Qaraqalpaqsha</a></li><li class=\"interlanguage-link interwiki-kab\"><a href=\"https://kab.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 卡拜尔语\" lang=\"kab\" hreflang=\"kab\" class=\"interlanguage-link-target\">Taqbaylit</a></li><li class=\"interlanguage-link interwiki-kk\"><a href=\"https://kk.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 哈萨克语\" lang=\"kk\" hreflang=\"kk\" class=\"interlanguage-link-target\">Қазақша</a></li><li class=\"interlanguage-link interwiki-km\"><a href=\"https://km.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 高棉语\" lang=\"km\" hreflang=\"km\" class=\"interlanguage-link-target\">ភាសាខ្មែរ</a></li><li class=\"interlanguage-link interwiki-kn\"><a href=\"https://kn.wikipedia.org/wiki/%E0%B2%90%E0%B2%8E%E0%B2%B8%E0%B3%8D%E0%B2%92_%E0%B3%A9%E0%B3%A7%E0%B3%AC%E0%B3%AC-%E0%B3%A7\" title=\"ಐಎಸ್ಒ ೩೧೬೬-೧ – 卡纳达语\" lang=\"kn\" hreflang=\"kn\" class=\"interlanguage-link-target\">ಕನ್ನಡ</a></li><li class=\"interlanguage-link interwiki-ko\"><a href=\"https://ko.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 韩语\" lang=\"ko\" hreflang=\"ko\" class=\"interlanguage-link-target\">한국어</a></li><li class=\"interlanguage-link interwiki-ku\"><a href=\"https://ku.wikipedia.org/wiki/L%C3%AEsteya_kod%C3%AAn_ISO_y%C3%AAn_dewletan\" title=\"Lîsteya kodên ISO yên dewletan – 库尔德语\" lang=\"ku\" hreflang=\"ku\" class=\"interlanguage-link-target\">Kurdî</a></li><li class=\"interlanguage-link interwiki-ky\"><a href=\"https://ky.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 柯尔克孜语\" lang=\"ky\" hreflang=\"ky\" class=\"interlanguage-link-target\">Кыргызча</a></li><li class=\"interlanguage-link interwiki-lb\"><a href=\"https://lb.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 卢森堡语\" lang=\"lb\" hreflang=\"lb\" class=\"interlanguage-link-target\">Lëtzebuergesch</a></li><li class=\"interlanguage-link interwiki-li\"><a href=\"https://li.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 林堡语\" lang=\"li\" hreflang=\"li\" class=\"interlanguage-link-target\">Limburgs</a></li><li class=\"interlanguage-link interwiki-lt\"><a href=\"https://lt.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 立陶宛语\" lang=\"lt\" hreflang=\"lt\" class=\"interlanguage-link-target\">Lietuvių</a></li><li class=\"interlanguage-link interwiki-lv badge-Q17506997 badge-featuredlist\" title=\"特色列表\"><a href=\"https://lv.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 拉脱维亚语\" lang=\"lv\" hreflang=\"lv\" class=\"interlanguage-link-target\">Latviešu</a></li><li class=\"interlanguage-link interwiki-mg\"><a href=\"https://mg.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 马拉加斯语\" lang=\"mg\" hreflang=\"mg\" class=\"interlanguage-link-target\">Malagasy</a></li><li class=\"interlanguage-link interwiki-mk\"><a href=\"https://mk.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 马其顿语\" lang=\"mk\" hreflang=\"mk\" class=\"interlanguage-link-target\">Македонски</a></li><li class=\"interlanguage-link interwiki-mn\"><a href=\"https://mn.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 蒙古语\" lang=\"mn\" hreflang=\"mn\" class=\"interlanguage-link-target\">Монгол</a></li><li class=\"interlanguage-link interwiki-mr\"><a href=\"https://mr.wikipedia.org/wiki/%E0%A4%86%E0%A4%AF.%E0%A4%8F%E0%A4%B8.%E0%A4%93._%E0%A5%A9%E0%A5%A7%E0%A5%AC%E0%A5%AC-%E0%A5%A7\" title=\"आय.एस.ओ. ३१६६-१ – 马拉地语\" lang=\"mr\" hreflang=\"mr\" class=\"interlanguage-link-target\">मराठी</a></li><li class=\"interlanguage-link interwiki-ms\"><a href=\"https://ms.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 马来语\" lang=\"ms\" hreflang=\"ms\" class=\"interlanguage-link-target\">Bahasa Melayu</a></li><li class=\"interlanguage-link interwiki-mt\"><a href=\"https://mt.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 马耳他语\" lang=\"mt\" hreflang=\"mt\" class=\"interlanguage-link-target\">Malti</a></li><li class=\"interlanguage-link interwiki-nds\"><a href=\"https://nds.wikipedia.org/wiki/ISO-3166-1-Kodierlist\" title=\"ISO-3166-1-Kodierlist – 低地德语\" lang=\"nds\" hreflang=\"nds\" class=\"interlanguage-link-target\">Plattdüütsch</a></li><li class=\"interlanguage-link interwiki-nds-nl\"><a href=\"https://nds-nl.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 低萨克森语\" lang=\"nds-NL\" hreflang=\"nds-NL\" class=\"interlanguage-link-target\">Nedersaksies</a></li><li class=\"interlanguage-link interwiki-ne\"><a href=\"https://ne.wikipedia.org/wiki/%E0%A4%86%E0%A4%88%E0%A4%8F%E0%A4%B8%E0%A4%93_%E0%A5%A9%E0%A5%A7%E0%A5%AC%E0%A5%AC-%E0%A5%A7\" title=\"आईएसओ ३१६६-१ – 尼泊尔语\" lang=\"ne\" hreflang=\"ne\" class=\"interlanguage-link-target\">नेपाली</a></li><li class=\"interlanguage-link interwiki-nl\"><a href=\"https://nl.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 荷兰语\" lang=\"nl\" hreflang=\"nl\" class=\"interlanguage-link-target\">Nederlands</a></li><li class=\"interlanguage-link interwiki-no\"><a href=\"https://no.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 书面挪威语\" lang=\"nb\" hreflang=\"nb\" class=\"interlanguage-link-target\">Norsk bokmål</a></li><li class=\"interlanguage-link interwiki-ny\"><a href=\"https://ny.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 齐切瓦语\" lang=\"ny\" hreflang=\"ny\" class=\"interlanguage-link-target\">Chi-Chewa</a></li><li class=\"interlanguage-link interwiki-oc\"><a href=\"https://oc.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 奥克语\" lang=\"oc\" hreflang=\"oc\" class=\"interlanguage-link-target\">Occitan</a></li><li class=\"interlanguage-link interwiki-pa\"><a href=\"https://pa.wikipedia.org/wiki/%E0%A8%86%E0%A8%88_%E0%A8%90%E0%A9%B1%E0%A8%B8_%E0%A8%93_3166-1\" title=\"ਆਈ ਐੱਸ ਓ 3166-1 – 旁遮普语\" lang=\"pa\" hreflang=\"pa\" class=\"interlanguage-link-target\">ਪੰਜਾਬੀ</a></li><li class=\"interlanguage-link interwiki-pl\"><a href=\"https://pl.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 波兰语\" lang=\"pl\" hreflang=\"pl\" class=\"interlanguage-link-target\">Polski</a></li><li class=\"interlanguage-link interwiki-pnb\"><a href=\"https://pnb.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – Western Punjabi\" lang=\"pnb\" hreflang=\"pnb\" class=\"interlanguage-link-target\">پنجابی</a></li><li class=\"interlanguage-link interwiki-ps\"><a href=\"https://ps.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 普什图语\" lang=\"ps\" hreflang=\"ps\" class=\"interlanguage-link-target\">پښتو</a></li><li class=\"interlanguage-link interwiki-pt\"><a href=\"https://pt.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 葡萄牙语\" lang=\"pt\" hreflang=\"pt\" class=\"interlanguage-link-target\">Português</a></li><li class=\"interlanguage-link interwiki-rm\"><a href=\"https://rm.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 罗曼什语\" lang=\"rm\" hreflang=\"rm\" class=\"interlanguage-link-target\">Rumantsch</a></li><li class=\"interlanguage-link interwiki-ro\"><a href=\"https://ro.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 罗马尼亚语\" lang=\"ro\" hreflang=\"ro\" class=\"interlanguage-link-target\">Română</a></li><li class=\"interlanguage-link interwiki-roa-tara\"><a href=\"https://roa-tara.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – Tarantino\" lang=\"nap-x-tara\" hreflang=\"nap-x-tara\" class=\"interlanguage-link-target\">Tarandíne</a></li><li class=\"interlanguage-link interwiki-ru\"><a href=\"https://ru.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 俄语\" lang=\"ru\" hreflang=\"ru\" class=\"interlanguage-link-target\">Русский</a></li><li class=\"interlanguage-link interwiki-rue\"><a href=\"https://rue.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_%D0%BA%D1%80%D0%B0%D1%97%D0%BD\" title=\"Список країн – Rusyn\" lang=\"rue\" hreflang=\"rue\" class=\"interlanguage-link-target\">Русиньскый</a></li><li class=\"interlanguage-link interwiki-rw\"><a href=\"https://rw.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 卢旺达语\" lang=\"rw\" hreflang=\"rw\" class=\"interlanguage-link-target\">Kinyarwanda</a></li><li class=\"interlanguage-link interwiki-sah\"><a href=\"https://sah.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 萨哈语\" lang=\"sah\" hreflang=\"sah\" class=\"interlanguage-link-target\">Саха тыла</a></li><li class=\"interlanguage-link interwiki-sco\"><a href=\"https://sco.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 苏格兰语\" lang=\"sco\" hreflang=\"sco\" class=\"interlanguage-link-target\">Scots</a></li><li class=\"interlanguage-link interwiki-sh\"><a href=\"https://sh.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 塞尔维亚-克罗地亚语\" lang=\"sh\" hreflang=\"sh\" class=\"interlanguage-link-target\">Srpskohrvatski / српскохрватски</a></li><li class=\"interlanguage-link interwiki-si\"><a href=\"https://si.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 僧伽罗语\" lang=\"si\" hreflang=\"si\" class=\"interlanguage-link-target\">සිංහල</a></li><li class=\"interlanguage-link interwiki-simple\"><a href=\"https://simple.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – Simple English\" lang=\"en-simple\" hreflang=\"en-simple\" class=\"interlanguage-link-target\">Simple English</a></li><li class=\"interlanguage-link interwiki-sk\"><a href=\"https://sk.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 斯洛伐克语\" lang=\"sk\" hreflang=\"sk\" class=\"interlanguage-link-target\">Slovenčina</a></li><li class=\"interlanguage-link interwiki-sq\"><a href=\"https://sq.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 阿尔巴尼亚语\" lang=\"sq\" hreflang=\"sq\" class=\"interlanguage-link-target\">Shqip</a></li><li class=\"interlanguage-link interwiki-sr\"><a href=\"https://sr.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 塞尔维亚语\" lang=\"sr\" hreflang=\"sr\" class=\"interlanguage-link-target\">Српски / srpski</a></li><li class=\"interlanguage-link interwiki-su\"><a href=\"https://su.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 巽他语\" lang=\"su\" hreflang=\"su\" class=\"interlanguage-link-target\">Sunda</a></li><li class=\"interlanguage-link interwiki-sv\"><a href=\"https://sv.wikipedia.org/wiki/ISO_3166#ISO_3166-1-koder\" title=\"ISO 3166 – 瑞典语\" lang=\"sv\" hreflang=\"sv\" class=\"interlanguage-link-target\">Svenska</a></li><li class=\"interlanguage-link interwiki-sw\"><a href=\"https://sw.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 斯瓦希里语\" lang=\"sw\" hreflang=\"sw\" class=\"interlanguage-link-target\">Kiswahili</a></li><li class=\"interlanguage-link interwiki-ta\"><a href=\"https://ta.wikipedia.org/wiki/%E0%AE%90.%E0%AE%8E%E0%AE%9A%E0%AF%81.%E0%AE%93_3166-1\" title=\"ஐ.எசு.ஓ 3166-1 – 泰米尔语\" lang=\"ta\" hreflang=\"ta\" class=\"interlanguage-link-target\">தமிழ்</a></li><li class=\"interlanguage-link interwiki-te\"><a href=\"https://te.wikipedia.org/wiki/%E0%B0%A6%E0%B1%87%E0%B0%B6%E0%B0%BE%E0%B0%B2_%E0%B0%9C%E0%B0%BE%E0%B0%AC%E0%B0%BF%E0%B0%A4%E0%B0%BE_%E2%80%93_ISO_3166-1_%E0%B0%95%E0%B1%8B%E0%B0%A1%E0%B1%8D\" title=\"దేశాల జాబితా – ISO 3166-1 కోడ్ – 泰卢固语\" lang=\"te\" hreflang=\"te\" class=\"interlanguage-link-target\">తెలుగు</a></li><li class=\"interlanguage-link interwiki-tg\"><a href=\"https://tg.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 塔吉克语\" lang=\"tg\" hreflang=\"tg\" class=\"interlanguage-link-target\">Тоҷикӣ</a></li><li class=\"interlanguage-link interwiki-th\"><a href=\"https://th.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 泰语\" lang=\"th\" hreflang=\"th\" class=\"interlanguage-link-target\">ไทย</a></li><li class=\"interlanguage-link interwiki-ti\"><a href=\"https://ti.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 提格利尼亚语\" lang=\"ti\" hreflang=\"ti\" class=\"interlanguage-link-target\">ትግርኛ</a></li><li class=\"interlanguage-link interwiki-tt\"><a href=\"https://tt.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 鞑靼语\" lang=\"tt\" hreflang=\"tt\" class=\"interlanguage-link-target\">Татарча/tatarça</a></li><li class=\"interlanguage-link interwiki-tum\"><a href=\"https://tum.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 通布卡语\" lang=\"tum\" hreflang=\"tum\" class=\"interlanguage-link-target\">ChiTumbuka</a></li><li class=\"interlanguage-link interwiki-udm\"><a href=\"https://udm.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 乌德穆尔特语\" lang=\"udm\" hreflang=\"udm\" class=\"interlanguage-link-target\">Удмурт</a></li><li class=\"interlanguage-link interwiki-ug\"><a href=\"https://ug.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 维吾尔语\" lang=\"ug\" hreflang=\"ug\" class=\"interlanguage-link-target\">ئۇيغۇرچە / Uyghurche</a></li><li class=\"interlanguage-link interwiki-uk badge-Q17506997 badge-featuredlist\" title=\"特色列表\"><a href=\"https://uk.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 乌克兰语\" lang=\"uk\" hreflang=\"uk\" class=\"interlanguage-link-target\">Українська</a></li><li class=\"interlanguage-link interwiki-ur\"><a href=\"https://ur.wikipedia.org/wiki/%D8%A2%DB%8C%D8%B2%D9%88_3166-1\" title=\"آیزو 3166-1 – 乌尔都语\" lang=\"ur\" hreflang=\"ur\" class=\"interlanguage-link-target\">اردو</a></li><li class=\"interlanguage-link interwiki-uz\"><a href=\"https://uz.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 乌兹别克语\" lang=\"uz\" hreflang=\"uz\" class=\"interlanguage-link-target\">Oʻzbekcha/ўзбекча</a></li><li class=\"interlanguage-link interwiki-vec\"><a href=\"https://vec.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – Venetian\" lang=\"vec\" hreflang=\"vec\" class=\"interlanguage-link-target\">Vèneto</a></li><li class=\"interlanguage-link interwiki-vi\"><a href=\"https://vi.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 越南语\" lang=\"vi\" hreflang=\"vi\" class=\"interlanguage-link-target\">Tiếng Việt</a></li><li class=\"interlanguage-link interwiki-wuu\"><a href=\"https://wuu.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 吴语\" lang=\"wuu\" hreflang=\"wuu\" class=\"interlanguage-link-target\">吴语</a></li><li class=\"interlanguage-link interwiki-yo\"><a href=\"https://yo.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – 约鲁巴语\" lang=\"yo\" hreflang=\"yo\" class=\"interlanguage-link-target\">Yorùbá</a></li><li class=\"interlanguage-link interwiki-zh-yue\"><a href=\"https://zh-yue.wikipedia.org/wiki/ISO_3166-1\" title=\"ISO 3166-1 – Cantonese\" lang=\"yue\" hreflang=\"yue\" class=\"interlanguage-link-target\">粵語</a></li>\\t\\t\\t\\t</ul>\\n\\t\\t\\t\\t<div class=\"after-portlet after-portlet-lang\"><span class=\"wb-langlinks-edit wb-langlinks-link\"><a href=\"https://www.wikidata.org/wiki/Special:EntityPage/Q25275#sitelinks-wikipedia\" title=\"编辑跨语言链接\" class=\"wbc-editpage\">编辑链接</a></span></div>\\t\\t\\t</div>\\n\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t</div>\\n\\t\\t\\t\\t<div id=\"footer\" role=\"contentinfo\" lang=\"zh-Hans-CN\" dir=\"ltr\">\\n\\t\\t\\t\\t\\t\\t<ul id=\"footer-info\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-info-lastmod\"> 本页面最后修订于2019年12月30日 (星期一) 11:44。</li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-info-copyright\">本站的全部文字在<a rel=\"license\" href=\"//zh.wikipedia.org/wiki/Wikipedia:CC-BY-SA-3.0%E5%8D%8F%E8%AE%AE%E6%96%87%E6%9C%AC\" title=\"Wikipedia:CC-BY-SA-3.0协议文本\">知识共享 署名-相同方式共享 3.0协议</a><a rel=\"license\" href=\"//creativecommons.org/licenses/by-sa/3.0/deed.zh\" style=\"display:none;\"></a>之条款下提供，附加条款亦可能应用。（请参阅<a href=\"//foundation.wikimedia.org/wiki/Terms_of_Use\">使用条款</a>）<br />\\nWikipedia&reg;和维基百科标志是<a href=\"//wikimediafoundation.org\">维基媒体基金会</a>的注册商标；维基&trade;是维基媒体基金会的商标。<br />\\n维基媒体基金会是按美国国内税收法501(c)(3)登记的<a href=\"//wikimediafoundation.org/wiki/Tax_Deductibility/en\">非营利慈善机构</a>。<br /></li>\\n\\t\\t\\t\\t\\t\\t\\t</ul>\\n\\t\\t\\t\\t\\t\\t<ul id=\"footer-places\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-privacy\"><a href=\"https://foundation.wikimedia.org/wiki/Privacy_policy\" class=\"extiw\" title=\"wmf:Privacy policy\">隐私政策</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-about\"><a href=\"/wiki/Wikipedia:%E5%85%B3%E4%BA%8E\" title=\"Wikipedia:关于\">关于维基百科</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-disclaimer\"><a href=\"/wiki/Wikipedia:%E5%85%8D%E8%B4%A3%E5%A3%B0%E6%98%8E\" title=\"Wikipedia:免责声明\">免责声明</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-developers\"><a href=\"https://www.mediawiki.org/wiki/Special:MyLanguage/How_to_contribute\">开发者</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-statslink\"><a href=\"https://stats.wikimedia.org/v2/#/zh.wikipedia.org\">统计</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-cookiestatement\"><a href=\"https://foundation.wikimedia.org/wiki/Cookie_statement\">Cookie声明</a></li>\\n\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-places-mobileview\"><a href=\"//zh.m.wikipedia.org/w/index.php?title=ISO_3166-1&amp;mobileaction=toggle_view_mobile\" class=\"noprint stopMobileRedirectToggle\">手机版视图</a></li>\\n\\t\\t\\t\\t\\t\\t\\t</ul>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<ul id=\"footer-icons\" class=\"noprint\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-copyrightico\">\\n\\t\\t\\t\\t\\t\\t<a href=\"https://wikimediafoundation.org/\"><img src=\"/static/images/wikimedia-button.png\" srcset=\"/static/images/wikimedia-button-1.5x.png 1.5x, /static/images/wikimedia-button-2x.png 2x\" width=\"88\" height=\"31\" alt=\"Wikimedia Foundation\"/></a>\\t\\t\\t\\t\\t</li>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<li id=\"footer-poweredbyico\">\\n\\t\\t\\t\\t\\t\\t<a href=\"https://www.mediawiki.org/\"><img src=\"/static/images/poweredby_mediawiki_88x31.png\" alt=\"Powered by MediaWiki\" srcset=\"/static/images/poweredby_mediawiki_132x47.png 1.5x, /static/images/poweredby_mediawiki_176x62.png 2x\" width=\"88\" height=\"31\"/></a>\\t\\t\\t\\t\\t</li>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</ul>\\n\\t\\t\\t\\t\\t\\t<div style=\"clear: both;\"></div>\\n\\t\\t</div>\\n\\t\\t\\n\\n<script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({\"wgPageParseReport\":{\"limitreport\":{\"cputime\":\"4.432\",\"walltime\":\"6.633\",\"ppvisitednodes\":{\"value\":37345,\"limit\":1000000},\"ppgeneratednodes\":{\"value\":0,\"limit\":1500000},\"postexpandincludesize\":{\"value\":927823,\"limit\":2097152},\"templateargumentsize\":{\"value\":46008,\"limit\":2097152},\"expansiondepth\":{\"value\":16,\"limit\":40},\"expensivefunctioncount\":{\"value\":214,\"limit\":500},\"unstrip-depth\":{\"value\":1,\"limit\":20},\"unstrip-size\":{\"value\":5950,\"limit\":5000000},\"entityaccesscount\":{\"value\":0,\"limit\":400},\"timingprofile\":[\"100.00% 5004.522      1 -total\",\" 41.33% 2068.209    247 Template:Flag\",\" 24.22% 1211.995      2 Template:Navbox\",\" 23.32% 1166.890      1 Template:ISO\",\" 22.72% 1137.249    217 Template:Tsl\",\" 21.34% 1067.829    217 Template:Link-en\",\" 20.40% 1020.679    217 Template:Internal_link_helper\",\"  6.62%  331.436    221 Template:Lan\",\"  4.70%  235.266    247 Template:Flag/core\",\"  3.98%  199.089      1 Template:Lang-en\"]},\"scribunto\":{\"limitreport-timeusage\":{\"value\":\"0.900\",\"limit\":\"10.000\"},\"limitreport-memusage\":{\"value\":21133701,\"limit\":52428800}},\"cachereport\":{\"origin\":\"mw1272\",\"timestamp\":\"20200127161142\",\"ttl\":2592000,\"transientcontent\":false}}});});</script>\\n<script type=\"application/ld+json\">{\"@context\":\"https:\\\\/\\\\/schema.org\",\"@type\":\"Article\",\"name\":\"ISO 3166-1\",\"url\":\"https:\\\\/\\\\/zh.wikipedia.org\\\\/wiki\\\\/ISO_3166-1\",\"sameAs\":\"http:\\\\/\\\\/www.wikidata.org\\\\/entity\\\\/Q25275\",\"mainEntity\":\"http:\\\\/\\\\/www.wikidata.org\\\\/entity\\\\/Q25275\",\"author\":{\"@type\":\"Organization\",\"name\":\"\\\\u7ef4\\\\u57fa\\\\u5a92\\\\u4f53\\\\u9879\\\\u76ee\\\\u8d21\\\\u732e\\\\u8005\"},\"publisher\":{\"@type\":\"Organization\",\"name\":\"Wikimedia Foundation, Inc.\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\\/\\\\/www.wikimedia.org\\\\/static\\\\/images\\\\/wmf-hor-googpub.png\"}},\"datePublished\":\"2004-03-11T09:20:55Z\",\"dateModified\":\"2019-12-30T11:44:43Z\",\"headline\":\"\\\\u570b\\\\u969b\\\\u6a19\\\\u6e96\\\\u5316\\\\u7d44\\\\u7e54\\\\u6a19\\\\u6e96\"}</script>\\n<script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({\"wgBackendResponseTime\":6888,\"wgHostname\":\"mw1272\"});});</script>\\n</body>\\n</html>\\n'"
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "\n",
    "proxies = { \"http\": \"http://127.0.0.1:1087\", \"https\": \"http://127.0.0.1:1087\" } \n",
    "\n",
    "iso_3166 = requests.get(\"https://zh.wikipedia.org/wiki/ISO_3166-1\", headers= { \"accept-language\": \"zh-CN,zh;q=0.9\" }, proxies=proxies).text\n",
    "iso_3166"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>code</th>\n      <th>name</th>\n      <th>name_en</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>AF</td>\n      <td>阿富汗</td>\n      <td>Afghanistan</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>AX</td>\n      <td>奥兰</td>\n      <td>Åland Islands</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>AL</td>\n      <td>阿尔巴尼亚</td>\n      <td>Albania</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>DZ</td>\n      <td>阿尔及利亚</td>\n      <td>Algeria</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>AS</td>\n      <td>美属萨摩亚</td>\n      <td>American Samoa</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>244</th>\n      <td>WF</td>\n      <td>瓦利斯和富图纳</td>\n      <td>Wallis and Futuna</td>\n    </tr>\n    <tr>\n      <th>245</th>\n      <td>EH</td>\n      <td>阿拉伯撒哈拉民主共和国</td>\n      <td>Western Sahara</td>\n    </tr>\n    <tr>\n      <th>246</th>\n      <td>YE</td>\n      <td>也门</td>\n      <td>Yemen</td>\n    </tr>\n    <tr>\n      <th>247</th>\n      <td>ZM</td>\n      <td>赞比亚</td>\n      <td>Zambia</td>\n    </tr>\n    <tr>\n      <th>248</th>\n      <td>ZW</td>\n      <td>津巴布韦</td>\n      <td>Zimbabwe</td>\n    </tr>\n  </tbody>\n</table>\n<p>249 rows × 3 columns</p>\n</div>",
      "text/plain": "    code         name            name_en\n0     AF          阿富汗        Afghanistan\n1     AX           奥兰      Åland Islands\n2     AL        阿尔巴尼亚            Albania\n3     DZ        阿尔及利亚            Algeria\n4     AS        美属萨摩亚     American Samoa\n..   ...          ...                ...\n244   WF      瓦利斯和富图纳  Wallis and Futuna\n245   EH  阿拉伯撒哈拉民主共和国     Western Sahara\n246   YE           也门              Yemen\n247   ZM          赞比亚             Zambia\n248   ZW         津巴布韦           Zimbabwe\n\n[249 rows x 3 columns]"
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from bs4 import BeautifulSoup\n",
    "import pandas as pd\n",
    "\n",
    "country_code_list = []\n",
    "for flag in BeautifulSoup(iso_3166).select(\"span.flagicon\"):\n",
    "    tds = flag.find_parent(\"tr\").find_all(\"td\")\n",
    "    if len(tds) <= 5:\n",
    "        continue\n",
    "    name_en = tds[0].text.strip()\n",
    "    code = tds[1].text.strip()\n",
    "    name = tds[5].text.strip()\n",
    "    country_code_list.append({\n",
    "        \"code\": code,\n",
    "        \"name\": name,\n",
    "        \"name_en\": name_en\n",
    "    })\n",
    "\n",
    "country_code_df = pd.DataFrame(country_code_list)\n",
    "country_code_df.to_csv(\"CountryCode.csv\", index=False)\n",
    "country_code_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": "lass=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654223</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>沙湾县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654224</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>托里县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654225</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>裕民县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654226</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>和布克赛尔蒙古自治县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7028029>654300</td>\\r\\n  <td class=xl7028029><span style=\\'mso-spacerun:yes\\'>\\xa0</span>阿勒泰地区</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654301</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>阿勒泰市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654321</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>布尔津县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654322</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>富蕴县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654323</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>福海县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654324</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>哈巴河县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654325</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>青河县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>654326</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>吉木乃县</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659001</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>石河子市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659002</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>阿拉尔市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659003</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>图木舒克市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659004</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>五家渠市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659005</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>北屯市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659006</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>铁门关市</td>\\r\\n  <td class=xl6528029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6528029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659007</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>双河市</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6928029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659008</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>可克达拉市</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6928029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7128029>659009</td>\\r\\n  <td class=xl7128029><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0 </span>昆玉市</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6928029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7028029>710000</td>\\r\\n  <td class=xl7028029>台湾省</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6928029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7028029>810000</td>\\r\\n  <td class=xl7028029>香港特别行政区</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=19 style=\\'mso-height-source:userset;height:14.25pt\\'>\\r\\n  <td height=19 class=xl6928029 style=\\'height:14.25pt\\'></td>\\r\\n  <td class=xl7028029>820000</td>\\r\\n  <td class=xl7028029>澳门特别行政区</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=18 style=\\'mso-height-source:userset;height:13.5pt\\'>\\r\\n  <td height=18 class=xl6928029 style=\\'height:13.5pt\\'></td>\\r\\n  <td class=xl7228029></td>\\r\\n  <td class=xl7228029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=28 style=\\'mso-height-source:userset;height:21.0pt\\'>\\r\\n  <td colspan=5 height=28 class=xl7528029 width=548 style=\\'height:21.0pt;\\r\\n  width:411pt\\'>注：1、台湾省、香港特别行政区和澳门特别行政区暂缺地市和区县信息。</td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=25 style=\\'mso-height-source:userset;height:18.75pt\\'>\\r\\n  <td colspan=9 height=25 class=xl7528029 width=873 style=\\'height:18.75pt;\\r\\n  width:655pt\\'><span style=\\'font-variant-ligatures: normal;font-variant-caps: normal;\\r\\n  orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;\\r\\n  text-decoration-color: initial\\'><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0\\r\\n  </span>2.本表由统计人员每月根据民政统计信息管理系统中上报单位名称变动情况搜集相关文件编制，略滞后于区划调整文件发布时间。</span></td>\\r\\n </tr>\\r\\n <tr height=32 style=\\'mso-height-source:userset;height:24.0pt\\'>\\r\\n  <td colspan=9 height=32 class=xl7528029 width=873 style=\\'height:24.0pt;\\r\\n  width:655pt\\'><span style=\\'mso-spacerun:yes\\'>\\xa0\\xa0\\r\\n  </span>3.为保证上下年度统计工作有效衔接，各级民政统计人员将在当年12月底与区划部门核对并调整统计系统中所有上报单位名称，同时编制发布本表。<!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------></td>\\r\\n </tr>\\r\\n <tr height=18 style=\\'mso-height-source:userset;height:13.5pt\\'>\\r\\n  <td height=18 class=xl6828029 style=\\'height:13.5pt\\'></td>\\r\\n  <td class=xl7328029 width=99 style=\\'width:74pt\\'></td>\\r\\n  <td class=xl7328029 width=233 style=\\'width:175pt\\'></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6928029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=18 style=\\'mso-height-source:userset;height:13.5pt\\'>\\r\\n  <td height=18 class=xl6828029 style=\\'height:13.5pt\\'></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029></td>\\r\\n </tr>\\r\\n <tr height=18 style=\\'mso-height-source:userset;height:13.5pt\\'>\\r\\n  <td height=18 class=xl6828029 style=\\'height:13.5pt\\'></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------></td>\\r\\n  <td class=xl6328029></td>\\r\\n  <td class=xl6328029><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------></td>\\r\\n </tr>\\r\\n <tr height=18 style=\\'mso-height-source:userset;height:13.5pt\\'>\\r\\n  <td height=18 class=xl6828029 style=\\'height:13.5pt\\'></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029></td>\\r\\n  <td class=xl6828029><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------><!-----------------------------><!--“从 EXCEL 发布网页”向导结束--><!-----------------------------></td>\\r\\n </tr>\\r\\n <![if supportMisalignedColumns]>\\r\\n <tr height=0 style=\\'display:none\\'>\\r\\n  <td width=72 style=\\'width:54pt\\'></td>\\r\\n  <td width=99 style=\\'width:74pt\\'></td>\\r\\n  <td width=233 style=\\'width:175pt\\'></td>\\r\\n  <td width=72 style=\\'width:54pt\\'></td>\\r\\n  <td width=72 style=\\'width:54pt\\'></td>\\r\\n  <td width=109 style=\\'width:82pt\\'></td>\\r\\n  <td width=72 style=\\'width:54pt\\'></td>\\r\\n  <td width=72 style=\\'width:54pt\\'></td>\\r\\n  <td width=72 style=\\'width:54pt\\'></td>\\r\\n </tr>\\r\\n <![endif]>\\r\\n</table>\\r\\n\\r\\n</div>\\r\\n\\r\\n\\r\\n<!----------------------------->\\r\\n<!--“从 EXCEL 发布网页”向导结束-->\\r\\n<!----------------------------->\\r\\n</body>\\r\\n\\r\\n</html>\\r\\n'"
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "\n",
    "china_area_code_data = requests.get(\"http://www.mca.gov.cn/article/sj/xzqh/2019/2019/201912251506.html\").text\n",
    "china_area_code_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>code</th>\n      <th>name</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>110000</td>\n      <td>北京市</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>110101</td>\n      <td>东城区</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>110102</td>\n      <td>西城区</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>110105</td>\n      <td>朝阳区</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>110106</td>\n      <td>丰台区</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>3207</th>\n      <td>659008</td>\n      <td>可克达拉市</td>\n    </tr>\n    <tr>\n      <th>3208</th>\n      <td>659009</td>\n      <td>昆玉市</td>\n    </tr>\n    <tr>\n      <th>3209</th>\n      <td>710000</td>\n      <td>台湾省</td>\n    </tr>\n    <tr>\n      <th>3210</th>\n      <td>810000</td>\n      <td>香港特别行政区</td>\n    </tr>\n    <tr>\n      <th>3211</th>\n      <td>820000</td>\n      <td>澳门特别行政区</td>\n    </tr>\n  </tbody>\n</table>\n<p>3212 rows × 2 columns</p>\n</div>",
      "text/plain": "        code     name\n0     110000      北京市\n1     110101      东城区\n2     110102      西城区\n3     110105      朝阳区\n4     110106      丰台区\n...      ...      ...\n3207  659008    可克达拉市\n3208  659009      昆玉市\n3209  710000      台湾省\n3210  810000  香港特别行政区\n3211  820000  澳门特别行政区\n\n[3212 rows x 2 columns]"
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import re\n",
    "from bs4 import BeautifulSoup\n",
    "\n",
    "china_area_code_list = []\n",
    "for tr in BeautifulSoup(china_area_code_data).select(\"tr\"):\n",
    "    tds = tr.find_all('td')\n",
    "    if len(tds) <= 2:\n",
    "        continue\n",
    "    code = tds[1].text.strip()\n",
    "    name = tds[2].text.strip()\n",
    "    if re.match(\"\\\\d+\", code):\n",
    "        china_area_code_list.append({\n",
    "            \"code\": code,\n",
    "            \"name\": name\n",
    "        })\n",
    "\n",
    "china_area_code_df = pd.DataFrame(china_area_code_list)\n",
    "china_area_code_df.to_csv(\"ChinaAreaCode.csv\", index=False)\n",
    "china_area_code_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}